package com.hamster.crmpre.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hamster.crmpre.pojo.EmployeePotentialCustomer;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author Tarry
 * @create 2019/12/21 11:33
 */
@Repository
@Mapper
public interface EmployeePotentialCustomerMapper extends BaseMapper<EmployeePotentialCustomer> {

    /**
     * 更改状态为跟踪
     * @param id  员工id
     * @param potentialCustomerId  潜在客户id
     */
    @Update("update employee_potential_customer set state=1 where employee_id = #{id} and potential_customer_id = #{pid}")
    void updateState(@Param("id") String id,@Param("pid") String potentialCustomerId);

    @Select("select B.name from employee_potential_customer A,employee B where A.employee_id = B.id  and A.potential_customer_id = #{id} ")
    List<String> selectTraceName(@Param("id") String id);
}
